/** CS2340 Spring 2011 Project
 *  Team: 40 Jiggawatt Hard Driver
 *  Suk Hwan Hong
 *  Rhys Saraceni
 *  Travis Cooper
 *  Luke Stubb
 *
 * @author 40 Jiggawatt Hard Driver
 * @version 1.0 
 */

package edu.gatech.jiggawatt.office.model;

import java.io.Serializable;
import java.util.Calendar;

/**
 * Represents Monthly Schedule
 * @author 40 Jiggawatt Hard Driver
 * @version 1.0
 *
 */
public class MonthlySchedule implements Serializable // $codepro.audit.disable declareDefaultConstructors
{
	private int year;
	private int month;
	
	DailySchedule[] days;
	

	/**
	 * Creates monthly schedule
	 * @param year
	 * @param month
	 * @param numDays
	 */
	public MonthlySchedule(int year, int month, int numDays)
	{
		this.year = year;
		this.month = month;
		days = new DailySchedule[numDays];
		Calendar calendar = Calendar.getInstance();
		
		for (int i = 0; i < numDays; i++)
		{
			calendar.set(year,month-1,i+1);
			int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK); // $codepro.audit.disable variableDeclaredInLoop
			days[i] = new DailySchedule(year,month, i+1, dayOfWeek);
			//days[i].printDay(); Debug purpose
		}
	}
	
	/**
	 * gets daily schedule
	 * @param day
	 * @return daily schedule
	 */
	public DailySchedule getDailySchedule(int day)
	{
		return days[day - 1];
	}
	
	/**
	 * gets list of daily schedule
	 * @return list of daily schedules
	 */
	public DailySchedule[] getDailySchedules()
	{
		return days;
	}
	
	/**
	 * gets month
	 * @return month
	 */
	public int getMonth()
	{
		return month;
	}
	
	/**
	 * gets year
	 * @return year
	 */
	public int getYear()
	{
		return year;
	}
	
	/**
	 * returns string format of monthly schedule
	 * @return string format of monthly schedule
	 */
	public String toString()
	{
		return month + "";
	}
}
